<? if(isset($label) && !empty($label)): ?>
	<?= $this->Form->label($name, $label) ?>
<? endif; ?>
<div class="left">
	<?php
	    if(empty($select)) $select = 'void';
	
	    $store_id = $store_label = '';
	    if(!empty($value)) {
    	    if(empty($clients)) {
    	        App::import('Model', 'Client');
    	        $Client = new Client();
    	        $clients = $Client->find('list');
    	    }
    	    
    	    $store_id      = $value['id'];
    	    $store_name    = $value['name'];
    	    $store_address = $value['address'] . ', ' . $value['township'] . ', ' . $value['city'];
    	    
    		if(empty($store_name) && !empty($value['client_id'])) {
    		    $store_name = $clients[$value['client_id']];
    		}
    		
    		$store_label = "{$store_name} ({$store_address})";
	    }
	?>
	<?= $this->Boni->autocomplete($name, array(
		'url' => '/prodavnice/search/json:1/{kword}',
		'value' => array($store_id, $store_label),
	    'onselect' => $select,
        'reset' => (bool)@$reset
	)) ?>
</div>